package api.http.object.api;

import com.google.gson.Gson;
import com.trello.rxlifecycle2.components.support.RxAppCompatActivity;

import api.base.bean.BasicResponse;
import api.base.impl.BaseImpl;
import api.base.observer.DefaultObserver;
import api.http.object.bean.ObjectBean;
import api.http.object.bean.Student;
import okhttp3.RequestBody;

/**
 * Created by Administrator on 2018-01-1 */

public class ObjectImpl extends BaseImpl<ObjectService> implements IObject<Student> {
    @Override
    public void addObject(RxAppCompatActivity context, Student student, DefaultObserver<BasicResponse<ObjectBean>> observer) {
        RequestBody body=RequestBody.create(okhttp3.MediaType.parse("application/json;charset=utf-8"), new Gson().toJson(student));
        scheduler(mService.addObject("ZZZZZZZZ",body))
                .compose(context.<BasicResponse<ObjectBean>>bindToLifecycle())
                .subscribe(observer);
    }

    @Override
    public void removeObject(RxAppCompatActivity context,Student student,DefaultObserver<BasicResponse<ObjectBean>> observer) {

    }

    @Override
    public void updataObject(RxAppCompatActivity context, Student student, DefaultObserver<BasicResponse<ObjectBean>> observer) {

    }

    @Override
    public void delObject(RxAppCompatActivity context, Student student, DefaultObserver<BasicResponse<ObjectBean>> observer) {

    }

}
